namespace Sidvall.Business
{
	public class PropertyChangeEventData<T>
	{
		#region Business Members

		public T Value { get; protected set; }
		public T OldValue { get; protected set; }
		public bool Cancel { get; set; }

		#endregion
		#region Constructors

		protected PropertyChangeEventData()
		{
		}

		public PropertyChangeEventData(T value, T oldValue)
		{
			this.Value = value;
			this.OldValue = oldValue;
			if (value == null)
			{
				if (oldValue == null)
					this.Cancel = true;
			}
			else if (oldValue != null)
			{
				if (value.Equals(oldValue) == true)
					this.Cancel = true;
			}
		}

		#endregion
	}
}
